package com.tengfei.ui_widget;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    // 初始化组件
    @BindView(R.id.bt_textview)
    Button textView;
    @BindView(R.id.bt_edit_view)
    Button editView;
    @BindView(R.id.bt_image_view)
    Button imageView;
    @BindView(R.id.bt_btnAndImgBtn)
    Button btnAndImgBtn;
    @BindView(R.id.bt_radioBtn)
    Button radioBtn;
    @BindView(R.id.bt_chkBox)
    Button checkBox;
    @BindView(R.id.bt_toggleBtn)
    Button toggleBtn;
    @BindView(R.id.bt_processBar)
    Button processBar;
    @BindView(R.id.bt_seekBar)
    Button seekBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // 写了这个就不用写findViewById(),与上面注解共同使用
        ButterKnife.bind(this);
    }

    // 绑定按钮事件
    @OnClick({R.id.bt_textview, R.id.bt_edit_view, R.id.bt_image_view, R.id.bt_btnAndImgBtn, R.id.bt_radioBtn,
            R.id.bt_chkBox, R.id.bt_toggleBtn, R.id.bt_processBar, R.id.bt_seekBar})
    public void onViewClick(View view) {
        Intent intent = null;
        switch (view.getId()) {
            // 返回箭头
            case R.id.bt_textview:
                intent = new Intent(this, TextViewActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_edit_view:
                intent = new Intent(this, EditTextActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_image_view:
                intent = new Intent(this, ImageViewActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_btnAndImgBtn:
                intent = new Intent(this, ButtonActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_radioBtn:
                intent = new Intent(this, RadioButtonActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_chkBox:
                intent = new Intent(this, CheckBoxActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_toggleBtn:
                intent = new Intent(this, ToggleButtonActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_processBar:
                intent = new Intent(this, ProgressBarActivity.class);
                startActivity(intent);
                break;
            case R.id.bt_seekBar:
                intent = new Intent(this, SeekBarActivity.class);
                startActivity(intent);
                break;

        }
    }


}